package com.example.homework;

import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class WebViewActivity extends AppCompatActivity {
    WebView webView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview_layout);
        setTitle("源代码");
        this.webView=findViewById(R.id.web);
        this.webView.getSettings().setJavaScriptEnabled(true);
        Intent intent=getIntent();
        String url=intent.getStringExtra("url");
        if (url!=null){
            webView.loadUrl(url);
        }
    }
}
